<template>
  <div>
    <h3 style="font-weight:600;font-size:22px;margin-top: -10px;">产品信息</h3>
    <el-form :model="formData" label-width="150px">
<!--        <h3 style="font-weight:bolder;">基本信息</h3>-->
          <el-row>
            <el-col :span="12">
                <el-form-item label="产品名称：">{{ formData.productName }}</el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="产品类型：">{{sourceType[formData.sourceType] }}</el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="生成方式：">{{generationMode[formData.generationMode] }}</el-form-item>
            </el-col>
            <el-col :span="12" v-if="formData.generationMode===1">
              <el-form-item label="定制申请：">{{formData.customRequestId}}</el-form-item>
            </el-col>
<!--            在线数据产品-->
            <el-col :span="12" v-if="formData.sourceType===1">
              <el-form-item label="关联数据资源ID：">
                {{formData.sourceId}}
              </el-form-item>
            </el-col>
<!--            离线数据产品-->
            <el-col :span="12" v-if="formData.sourceType===4">
              <el-form-item label="数据资源文件：">
<!--                {{formData.offlineFileUrl}}-->
                {{formData.offlineFileUrl.split('/')[formData.offlineFileUrl.split('/').length-1]}}
              </el-form-item>
            </el-col>
            <!--            算法产品-->
            <el-col :span="12" v-if="formData.sourceType===3">
              <el-form-item label="算法名：">
                {{formData.algName}}
              </el-form-item>
            </el-col>
            <!--            算法文件-->
            <el-col :span="12" v-if="formData.sourceType===3">
              <el-form-item label="算法文件：" v-if="formData.algFileUrl">
                {{formData.algFileUrl.split('/')[formData.algFileUrl.split('/').length-1]}}
              </el-form-item>
            </el-col>
<!--            应用产品-混合套餐名字-->
            <el-col :span="12" v-if="formData.sourceType===5">
              <el-form-item label="所选混合套餐：">{{ formData.productMixName }}</el-form-item>
            </el-col>
            <el-col :span="12">
                <el-form-item label="关键字：">{{ formData.keyWords }}</el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="所属分类：">
                <span v-for="(item,index) in formData.systemFieldList" :key="index"> {{ item.fieldName }} &nbsp;&nbsp;</span>
              </el-form-item>
            </el-col>
            <el-col :span="12">
                <el-form-item label="允许试用：">{{ isTry[formData.isTry] }}</el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="是否监管使用：">{{ isControl[formData.isControl] }}</el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="是否可信认证：">{{ isAuth[Number(formData.isAuth)] }}</el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="审核方式：">{{ isAudit[formData.isAudit] }}</el-form-item>
            </el-col>
            <el-col :span="12">
                <el-form-item label="产品简介：">{{ formData.brief? formData.brief:'无' }}</el-form-item>
            </el-col>
            <el-col :span="12">
                <el-form-item label="产品定义：">
                  {{ formData.definition?formData.definition:'无' }}
<!--                  <el-input type="textarea" v-model=" formData.definition"></el-input>-->
                </el-form-item>
            </el-col>
            <el-col :span="12">
                <el-form-item label="详细说明：">{{ formData.detail?formData.detail:'无' }}</el-form-item>
            </el-col>
<!--            <el-col :span="12">-->
<!--                <el-form-item label="编程说明：">{{ formData.programming? formData.programming:'无' }}</el-form-item>-->
<!--            </el-col>-->
            <el-col :span="12">
<!--              <el-form-item label="可见规则：">{{ // formData.controlRuleName? formData.controlRuleName+'规则':'无规则，任何人可见' }}</el-form-item>-->
              <el-form-item label="可见规则：">{{  controlRule[formData.controlRuleId]?controlRule[formData.controlRuleId]:formData.controlRuleName+'规则' }}</el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="申购规则：">{{ controlRule[formData.buyRuleId]?controlRule[formData.buyRuleId]:formData.buyRuleName+'规则'}}</el-form-item>
<!--              <el-form-item label="申购规则：">{{ formData.buyRuleName? formData.buyRuleName+'规则':'无规则，任何人可使用' }}</el-form-item>-->
            </el-col>
<!--            参数文件-->
            <el-col :span="12" v-if="formData.appProductUrl">
                <el-form-item label="文件地址：">
                  {{formData.appProductUrl.split('/')[formData.appProductUrl.split('/').length-1]}}
                </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item label="展示图标：">
                <template v-if="formData.iconUrl">
                  <img :src="formData.iconUrl" alt="" style="width: 200px;height: 200px;">
                </template>
                <template v-if="!formData.iconUrl">
                  <span>无</span>
                </template>
              </el-form-item>
            </el-col>
          </el-row>
<!--      <h3 style="font-weight:bolder;">参数设置</h3>-->
<!--      <el-row>-->
<!--        <div v-for="(item,index) in formData.dataproductParamList" :key="index">-->
<!--          <el-row>-->
<!--            <el-col :span="6">-->
<!--              <el-form-item label="参数名称：" :prop="'dataproductParamList.' + index + '.paramName'">-->
<!--                {{ item.paramName }}-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--            <el-col :span="6">-->
<!--              <el-form-item label="参数KEY：" :prop="'dataproductParamList.' + index + '.paramKey'">-->
<!--                {{ item.paramKey }}-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--            <el-col :span="6">-->
<!--              <el-form-item label="是否可选：" :prop="'dataproductParamList.' + index + '.chooseType'">-->
<!--                {{ chooseType[item.chooseType] }}-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--            <el-col :span="6">-->
<!--              <el-form-item label="关系类型：" :prop="'dataproductParamList.' + index + '.relationshipType'">-->
<!--                {{ relationshipType[item.relationshipType]}}-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--            <el-col :span="24">-->
<!--              <el-form-item label="备注说明：" :prop="'dataproductParamList.' + index + '.remark'">-->
<!--                {{ item.remark }}-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--          </el-row>-->
<!--        </div>-->
<!--      </el-row>-->
<!--      <h3 style="font-weight:bolder;">价格设置</h3>-->
<!--      <el-row>-->
<!--        <div v-for="(item,index) in formData.dataproductPriceList" :key="index" >-->
<!--          <el-row >-->
<!--            <el-col :span="6">-->
<!--              <el-form-item label="特定用户：" :prop="'dataproductPriceList.' + index + '.userId'">-->

<!--                <div v-if="item.userId">-->
<!--                      <span v-for="(item1,index1) in AllUserInfoList" :key="index1">-->
<!--                        <span v-if="item1.userId==item.userId">-->
<!--                          {{item1.nickName}}-->
<!--                        </span>-->
<!--                      </span>-->
<!--                </div>-->
<!--                <div v-else>-->
<!--                  <span>所有人</span>-->
<!--                </div>-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--            <el-col :span="6">-->
<!--              <el-form-item label="用户类型：" :prop="'dataproductPriceList.' + index + '.userType'">-->
<!--                {{ userType[item.userType] }}-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--            <el-col :span="6">-->
<!--              <el-form-item label="用户级别：" :prop="'dataproductPriceList.' + index + '.userLevel'">-->
<!--                {{ userLevel[item.userLevel] }}-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--            <el-col :span="6">-->
<!--              <el-form-item label="计费类别：" :prop="'dataproductPriceList.' + index + '.billingType'">-->
<!--                {{ billingType[item.billingType]}}-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--            <el-col :span="6">-->
<!--              <el-form-item label="使用周期：" :prop="'dataproductPriceList.' + index + '.usePeriod'">-->
<!--                {{ item.usePeriod }}-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--            <el-col :span="6">-->
<!--              <el-form-item label="计费单位：" :prop="'dataproductPriceList.' + index + '.productUnit'">-->
<!--                {{ item.productUnit }}-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--            <el-col :span="6">-->
<!--              <el-form-item label="价格设置：" :prop="'dataproductPriceList.' + index + '.price'">-->
<!--                {{ item.price }}-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--            <el-col :span="6">-->
<!--              <el-form-item label="备注说明：" :prop="'dataproductPriceList.' + index + '.remark'">-->
<!--                {{ item.remark }}-->
<!--              </el-form-item>-->
<!--            </el-col>-->
<!--          </el-row>-->
<!--        </div>-->
<!--      </el-row>-->
<!--      <h3 style="font-weight:bolder;">访问控制</h3>-->
<!--      <el-row>-->
<!--            <div v-for="(item,index) in formData.dataproductControlList" :key="index">-->
<!--              <el-col :span="6">-->
<!--                <el-form-item label="特定用户：" :prop="'dataproductControlList.' + index + '.userId'">-->

<!--                  <div v-if="item.userId">-->
<!--                      <span v-for="(item1,index1) in AllUserInfoList" :key="index1">-->
<!--                        <span v-if="item1.userId==item.userId">-->
<!--                          {{item1.nickName}}-->
<!--                        </span>-->
<!--                      </span>-->
<!--                    </div>-->
<!--                    <div v-else>-->
<!--                      <span>所有人</span>-->
<!--                    </div>-->
<!--                </el-form-item>-->
<!--              </el-col>-->
<!--              <el-col :span="6">-->
<!--                <el-form-item label="用户类型：" :prop="'dataproductControlList.' + index + '.userType'">-->
<!--                  {{ userType[item.userType] }}-->
<!--                </el-form-item>-->
<!--              </el-col>-->
<!--              <el-col :span="6">-->
<!--                <el-form-item label="用户级别：" :prop="'dataproductControlList.' + index + '.userLevel'">-->
<!--                  {{ userLevel[item.userLevel] }}-->
<!--                </el-form-item>-->
<!--              </el-col>-->
<!--              <el-col :span="6">-->
<!--                <el-form-item label="共享级别：" :prop="'dataproductControlList.' + index + '.sharedType'">-->
<!--                  {{ shareType[item.sharedType]}}-->
<!--                </el-form-item>-->
<!--              </el-col>-->
<!--              <el-col :span="6">-->
<!--                <el-form-item label="查询可见：" :prop="'dataproductControlList.' + index + '.isVisible'">-->
<!--                  {{ isVisible[item.isVisible] }}-->
<!--                </el-form-item>-->
<!--              </el-col>-->
<!--              <el-col :span="6">-->
<!--                <el-form-item label="说明：" :prop="'dataproductControlList.' + index + '.remark'">-->
<!--                  {{ item.remark }}-->
<!--                </el-form-item>-->
<!--              </el-col>-->
<!--            </div>-->
<!--          </el-row>-->
<!--          <h3 style="font-weight:bolder;" >扩展控制</h3>-->
<!--          <el-row>-->
<!--            <div v-for="(item,index) in formData.dataproductExtendList" :key="index">-->
<!--              <el-col :span="8">-->
<!--                <el-form-item label="用户类型：" :prop="'dataproductExtendList.' + index + '.userType'">-->
<!--                  {{ userType[item.userType] }}-->
<!--                </el-form-item>-->
<!--              </el-col>-->
<!--              <el-col :span="8">-->
<!--                <el-form-item label="用户级别：" :prop="'dataproductExtendList.' + index + '.userLevel'">-->
<!--                  {{ userLevel[item.userLevel] }}-->
<!--                </el-form-item>-->
<!--              </el-col>-->

<!--              <el-col :span="8">-->
<!--                <el-form-item label="购买是否需要审核：" :prop="'dataproductExtendList.' + index + '.isAudit'" label-width="140px">-->
<!--                  {{ isAudit[item.isAudit] }}-->
<!--                </el-form-item>-->
<!--              </el-col>-->
<!--            </div>-->
<!--        </el-row>-->

    </el-form>
  </div>
</template>

<script>
import { listUser } from "@/api/system/user";
export default {
  name: "ProductInfo",
  props:{
    formData:Object
  },
  data() {
    return {
      AllDatasourceBaseList: [],
      AllProductTypeList: [],
      disabled: false,
      AllUserInfoList: [],
      AllDataProductList: [],
      // 是否可选
      chooseType: {
        0: "不能",
        1: "能",
      },
      // 关系类型
      relationshipType: {
        0: "等于",
        1: "大于",
        2: "小于",
        4: "包含",
        8: "除外",
      },
      // 用户类型
      userType: {
        0: "个人",
        1: "私人企业",
        2: "国有重点企业",
        3: "组织机构",
        4: "事业单位",
        5: "普通局委办",
        6: "权力机构",
      },
      // 用户级别
      userLevel: {
        0: "最低级用户",
        1: "低级用户",
        2: "中级用户",
        3: "高级用户",
        4: "最高级用户",
      },
      // 计费类别
      billingType: {
        0: "按次数",
        1: "按记录数",
        2: "按字节",
        3: "按时长",
      },
      //查询可见
      isVisible: {
        0: "可见",
        1: "不可见",
      },
      // 共享类型
      shareType: {
        0: "无条件共享",
        1: "需要授权",
        2: "需要确权",
        3: "需要确认授权",
      },
      // 购买是否需要审核
      isAudit: {
        1: "人工审核",
        0: "自动审核",
      },
      // 是否可以试用
      isTry: {
        0: "不可以",
        1: "可以",
      },
      isControl:{
        1:"需要",
        0:"不需要"
    },
      isAuth:{
        1:"需要",
        0:"不需要"
      },
      sourceType:{
        1:"在线数据产品",
        2:"套餐数据产品",
        3:"算法产品",
        4:"离线数据产品",
        5:"应用产品"
      },
      generationMode:{
        0:"自定义生成",
        1:"定制生成"
      },
       queryParams: {
        pageNum: 1,
        pageSize: 10,
        keyword: "",
      },
      controlRule:{
        0:"继承数据资源规则",
        '-1':'无规则',
      }
    };
  },
  created() {
   this.getDataList()
  },
  methods: {
      getDataList(){
          listUser(this.queryParams).then((response) => {
            this.AllUserInfoList = response.rows;
        console.log('this.formData', this.formData)
            console.log(' controlRule[formData.controlRuleId]\n',  this.controlRule[this.formData.controlRuleId],)
          });
      }
  }
};
</script>
<style scoped>
  .el-form-item{
   margin-bottom: 0px !important;
  }
</style>
